//
//  HXDNavigationController.m
//  qingDaoCircleOfLife
//
//  Created by huxuedong on 15/11/21.
//  Copyright © 2015年 huxuedong. All rights reserved.
//

#import "HXDNavigationController.h"

@implementation HXDNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    //创建导航栏
    UIView *navigationView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kUIScreenWidth, kUINavHeight)];
    navigationView.backgroundColor = [UIColor colorWithRed:70 / 255.0 green:130 / 255.0 blue:250 / 255.0 alpha:1];
    [self.view addSubview:navigationView];
    self.navigationView = navigationView;
    //创建左边按钮
    UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    leftButton.frame = CGRectMake(0, kUIStatusBarHeight, kNavigationButtonWidth, kNavigationButtonWidth);
    [leftButton setBackgroundImage:[UIImage imageNamed:@"nav_back"] forState:UIControlStateNormal];
    [leftButton addTarget:self action:@selector(backMethod) forControlEvents:UIControlEventTouchUpInside];
    [self.navigationView addSubview:leftButton];
    self.leftButton = leftButton;
    //设置中间文字
    UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(kNavigationButtonWidth, kUIStatusBarHeight, kUIScreenWidth - 2 * kNavigationButtonWidth, kNavigationButtonWidth)];
    titleLabel.text = @"青岛生活圈";
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.font = [UIFont systemFontOfSize:19];
    [self.navigationView addSubview:titleLabel];
    self.titleLabel = titleLabel;
    //创建右边按钮
    UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [rightButton addTarget:self action:@selector(enterMethod) forControlEvents:UIControlEventTouchUpInside];
    [self.navigationView addSubview:rightButton];
    self.rightButton = rightButton;
    [self.rightButton setTitle:@"登录/注册" forState:UIControlStateNormal];
    self.rightButton.frame = CGRectMake(kUIScreenWidth - 2 * kNavigationButtonWidth, kUIStatusBarHeight, 2 * kNavigationButtonWidth, kNavigationButtonWidth);
}

- (void)backMethod {
    
}

- (void)enterMethod {
    
}

- (void)viewWillAppear:(BOOL)animated {
    //隐藏系统导航栏，使用自定义导航栏
    self.navigationController.navigationBar.hidden = YES;
}

@end
